import request from '@/utils/request'

// 登录
export function login(data) {
    return request({
        url: '/user/login',
        method: 'post',
        data: data
    })
}

// 获取用户及订单联查列表
export function getUserWithOrders(params) {
    return request({
        url: '/user/list-with-orders',  // 与后端接口路径保持一致
        method: 'get',
        params: params
    })
}

// 获取用户列表（保持与后端一致）
export function getUserList(params) {
    return request({
        url: '/user/list',
        method: 'get',
        params: params
    })
}

// 添加用户
export function addUser(data) {
    return request({
        url: '/user/add',
        method: 'post',
        data: data
    })
}

// 删除用户
export function deleteUser(id) {
    return request({
        url: `/api/user/delete/${id}`,
        method: 'delete'
    })

}
